<?php
// 获得所有医生信息
// header("content-type:text/html;charset=UTF-8");
include_once("conn.php");

if (isset($_GET["docid"])) {
    $docid = $_GET["docid"];

    $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $doc_ResetKey = '';

    for ($i = 0; $i < 8; $i++) {
        $doc_ResetKey .= $characters[rand(0, strlen($characters) - 1)];
    }

    $update = "UPDATE doc_infos SET doc_ResetKey = '".$doc_ResetKey."' WHERE doc_ID = '" . $docid . "'";
} else {
    die("<script>alert('传递参数错误！');history.go(-1);</script>");
}

if(mysqli_query($connect_DB, $update)){
    echo $doc_ResetKey;
}else{
    echo "生成失败，请重试！";
}

$connect_DB->close();
?>